import React, { Component } from 'react'

export default function HOCLogin(Com) {
    return class HOCLogin extends Component {
        componentDidMount(){
            const user=localStorage.getItem('user')?JSON.parse(localStorage.getItem('user')):{}
            if(!user.phone){
                this.props.history.push('/login')
            }
        }
        render() {
            return (
                <Com {...this.props}></Com>
            )
        }
    }
}
